﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BookingSystemModel;
using BookingSystemBLL;

public partial class AddFlight : System.Web.UI.Page
{
    private Flight flightInfo = new Flight();
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void OK_Click(object sender, EventArgs e)
    {
        FlightInfoText_Flight();
        FlightBLL.AddFlight(flightInfo);
        Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('添加成功！');</script>");
        
    }
    public void FlightInfoText_Flight()
    {
        flightInfo.FlightNumber = this.FlightNum.Text;
        flightInfo.FlightType = this.FlightModel.Text;
        flightInfo.FirstSeat = Convert.ToInt32(this.FirstSeat.Text);
        flightInfo.FirstSeatPrice = float.Parse(this.FirstSeatPrice.Text);
        flightInfo.BusinessSeat = Convert.ToInt32(this.BusinessSeat.Text);
        flightInfo.BusinessSeatPrice = float.Parse(this.BusinessSeatPrice.Text);
        flightInfo.EconomicSeat = Convert.ToInt32(this.EcomicSeat.Text);
        flightInfo.EconomicSeatPrice = float.Parse(this.EcomicSeatPrice.Text);
        flightInfo.FromDate = this.FromTime.Text;
        flightInfo.ToDate = this.ToTime.Text;
        flightInfo.FromTime = this.FromPoint.Text;
        flightInfo.FromAddress = this.FromAddress.Text;
        flightInfo.ToAddress = this.ToAddress.Text;
    }
}